

package vinterprojekt.controller;


import libisbn.*;

/** Facade-klassen agerer bindeled mellem gui-klasserne og controller-laget. Klassen er en simpel Proxy for disse.
 *
 * @author jacob
 */

public class Facade
{
    private static Facade instance = null;


    public static Facade getInstance()
    {
        if (instance == null) instance = new Facade();

        return instance;
    }

    private BookController bookController = null;
    private InputValidator inputValidator = null;
    private ISBNRetriever ir = null;
    private String isbnApiKey = "B5GA9EE5";

    private Facade()
    {
        bookController = new BookController();
        inputValidator = new InputValidator();
        ir = new ISBNRetriever(isbnApiKey);
    }

    public BookController getBookController()
    {
        return bookController;
    }

    public InputValidator getInputValidator()
    {
        return inputValidator;
    }

    public ISBNResult isbnLookup(String isbn) throws ISBNException
    {
        return ir.retrieve(isbn.trim());
    }

}